/* eslint-disable */
import { createApp } from "vue";
import ElementPlus from 'element-plus';
import 'element-plus/lib/theme-chalk/index.css';
import App from "./App.vue";
import router from "./router";  
import store from "./store";   

import { registerMicroApps, start, setDefaultMountApp } from 'qiankun';

registerMicroApps(
  [
    {
      name: 'user-app', // app name registered
      entry: process.env.VUE_APP_USER,
      container: '#child-view',
      activeRule: '/user-app',
      props: {
        container: '#user'
      }
    },
    {
      name: 'order-app',
      entry: process.env.VUE_APP_ORDER,
      container: '#child-view',
      activeRule: '/order-app',
      props: {
        container: '#order'
      }
    },
    {
        name: 'test-app',
        entry: process.env.VUE_APP_TEST,
        container: '#child-view',
        activeRule: '/test-app',
        props: {
          container: '#test'
        }
      },
  ],
  {
    beforeLoad: [
      (app:any) => {
        console.log('[LifeCycle] before load %c%s', 'color: green;', app.name);
      },
    ],
    beforeMount: [
      (app:any) => {
        console.log('[LifeCycle] before mount %c%s', 'color: green;', app.name);
      },
    ],
    afterUnmount: [
      (app:any) => {
        console.log('[LifeCycle] after unmount %c%s', 'color: green;', app.name);
      },
    ],
  }
);

setDefaultMountApp('/user');

createApp(App).use(ElementPlus).use(store).use(router).mount("#app").$nextTick(()=>{
  console.log("qiankun启动...")
  start();
});
